package com.webdrider.security.exceptions;

import com.common.security.abstracts.AbstractException;

/**
 * Error code range: 1161 - 1180
 * 
 * @author Ady
 *
 */
public class BlogException extends AbstractException {
	private static final long serialVersionUID = 1L;
	
	public static final int POST_NOT_FOUND = 1161;
	private static final String MESSAGE_POST_NOT_FOUND = "The post with the provided data was not found";
	
	public static final int MULTIPLE_POSTS_FOUND = 1162;
	private static final String MESSAGE_MULTIPLE_POSTS_FOUND = "More than one post was found with the provided data";
	
	public BlogException(int code) {
		super(code, getMessage(code));
	}
	
	private static String getMessage(int code) {
		switch (code) {
			case POST_NOT_FOUND: {
				return MESSAGE_POST_NOT_FOUND;
			}
			case MULTIPLE_POSTS_FOUND: {
				return MESSAGE_MULTIPLE_POSTS_FOUND;
			}
			default: {
				return MESSAGE_ERROR_NOT_FOUND;
			}
		}
	}
}
